import asyncio
import aiohttp

# async def task(param):
#     print(param)
#     await asyncio.sleep(1)
#
# async def main():
#     tasks = [task(i) for i in range(10)]
#     await asyncio.gather(*tasks)
#
# asyncio.run(main())


# async def main():
#     tasks = []
#     for i in range(10):
#         tasks.append(asyncio.create_task(task(i)))
#     await asyncio.wait(tasks)
# if __name__ == '__main__':
#     asyncio.run(main())



async def fetch(session, url):
    async with session.get(url) as response:
        return await response.json()

async def mian():
    async with aiohttp.ClientSession() as session:
        result = await asyncio.gather(*[fetch(session, f'https://httpbin.org/get?age={i}')for i in range(10)])
        for i in result:
            print(i)

asyncio.run(mian())